import { splitTime } from '../../../../src/base/util/time-util';

test('test time-format', ()=>{
  expect(splitTime('1 nanosecond')).toStrictEqual('1 ms ');
  expect(splitTime('2 nanoseconds')).toStrictEqual('1 ms ');
  expect(splitTime('1 microsecond')).toStrictEqual('1 ms ');
  expect(splitTime('2 microseconds')).toStrictEqual('1 ms ');
  expect(splitTime('1 millisecond')).toStrictEqual('1 ms ');
  expect(splitTime('2 milliseconds')).toStrictEqual('2 ms ');
  expect(splitTime('1 second')).toStrictEqual('1 s ');
  expect(splitTime('2 seconds')).toStrictEqual('2 s ');
  expect(splitTime('1 minute')).toStrictEqual('1 min ');
  expect(splitTime('2 minutes')).toStrictEqual('2 min ');
  expect(splitTime('1 hour')).toStrictEqual('1 h ');
  expect(splitTime('2 hours')).toStrictEqual('2 h ');
  expect(splitTime('2 hour 2 minutes 2 seconds 2 milliseconds 2 microseconds 2 nanoseconds'))
    .toStrictEqual('2 h 2 min 2 s 3 ms ');
  expect(splitTime('2 minutes 2 seconds 2 milliseconds 2 microseconds 2 nanoseconds'))
    .toStrictEqual('2 min 2 s 3 ms ');
  expect(splitTime('2 seconds 2 milliseconds 2 microseconds 2 nanoseconds'))
    .toStrictEqual('2 s 3 ms ');
  expect(splitTime('2 milliseconds 2 microseconds 2 nanoseconds'))
    .toStrictEqual('3 ms ');
  expect(splitTime('2 microseconds 2 nanoseconds'))
    .toStrictEqual('1 ms ');
});
